/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cageballcommon.messages;

/**
 *
 * @author kanonas
 */
public class PlayerAction {

    private Integer id;
    private Float moveX;
    private Float moveY;
    private Float kickX;
    private Float kickY;
    private Float kickStrength;
    private String say;

    public PlayerAction() {
    }

    public PlayerAction(PlayerAction playerAction){
        this.id = playerAction.getId();
        this.moveX = playerAction.getMoveX();
        this.moveY = playerAction.getMoveY();
        this.kickX = playerAction.getKickX();
        this.kickY = playerAction.getKickY();
        this.kickStrength = playerAction.getKickStrength();
        this.say = playerAction.getSay();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Float getKickStrength() {
        if (kickStrength == null) {
            return 1f;
        } else if(kickStrength > 1){
            return 1f;
        } else if(kickStrength < 0){
            return 0f;
        } else{
            return kickStrength;
        }
    }

    public void setKickStrength(Float kickStrength) {
        this.kickStrength = kickStrength;
    }

    public Float getKickX() {
        if (kickX == null) {
            return 0f;
        } else {
            return kickX;
        }
    }

    public void setKickX(Float kickX) {
        this.kickX = kickX;
    }

    public Float getKickY() {
        if (kickY == null) {
            return 0f;
        } else {
            return kickY;
        }
    }

    public void setKickY(Float kickY) {
        this.kickY = kickY;
    }

    public Float getMoveX() {
        return moveX;
    }

    public void setMoveX(Float moveX) {
        this.moveX = moveX;
    }

    public Float getMoveY() {
        return moveY;
    }

    public void setMoveY(Float moveY) {
        this.moveY = moveY;
    }

    public String getSay() {
        return say;
    }

    public void setSay(String say) {
        this.say = say;
    }

    public boolean hasMoveX() {
        return moveX != null;
    }

    public boolean hasMoveY() {
        return moveX != null;
    }

    public boolean hasKick() {
        return (kickX != null) || (kickY != null);
    }

    public boolean isValidAction() {
        return id != null;
    }
}
